
/*public class Solution {
    //根据描述创建二叉树
    public TreeNode createBinaryTree(int[][] descriptions) {
        // 存储所有的子节点
        Set<Integer> chlids = new HashSet<>();

        Map<Integer, TreeNode> map = new HashMap<>();
        // 构造树
        for (int[] d : descriptions) {
            int pVal = d[0], cVal = d[1];
            boolean left = (d[2] == 1) ? true : false;

            TreeNode pNode = map.get(pVal);
            if (pNode == null) {
                pNode = new TreeNode(pVal);
                map.put(pVal, pNode);
            }

            TreeNode cNode = map.get(cVal);
            if (cNode == null) {
                cNode = new TreeNode(cVal);
                map.put(cVal, cNode);
            }
            chlids.add(cVal);

            if (left) {
                pNode.left = cNode;
            } else {
                pNode.right = cNode;
            }
        }

        // 找到根节点
        TreeNode root = null;
        for (int v : map.keySet()) {
            if (chlids.contains(v)) continue;
            else {
                root = map.get(v);
                break;
            }
        }

        return root;
    }
}*/
